package com.example.instantmessage.fragment;

import android.content.Context;
import android.os.Bundle;

import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.instantmessage.R;
import com.example.instantmessage.adapter.MessageAdapter;
import com.tencent.imsdk.v2.V2TIMConversation;
import com.tencent.imsdk.v2.V2TIMConversationResult;
import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMValueCallback;

import java.util.ArrayList;
import java.util.List;

//没用

public class MessageInfoFragment extends Fragment {

    private View view;
    //private Context context;


//    private RecyclerView recyclerView;
//    private MessageAdapter messageAdapter;
//    private List<V2TIMConversation> conversations = new ArrayList<>();
//    private static final String TAG ="MessageInfoFragment" ;


    public MessageInfoFragment() {
        // Required empty public constructor
    }


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment


         view = inflater.inflate(R.layout.fragment_message_info, container, false);
        initView();
        return view;
    }



    private void initView() {
//        System.out.println("111111 initView");
//        recyclerView = view.findViewById(R.id.message_info_recyclerview);
//        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
//        messageAdapter = new MessageAdapter(getContext(),conversations);
//        recyclerView.setAdapter(messageAdapter);
//
//        V2TIMManager.getConversationManager().getConversationList(0, 50,
//                new V2TIMValueCallback<V2TIMConversationResult>() {
//
//
//                    @Override
//                    public void onError(int code, String desc) {
//                        System.out.println(conversations.size()+"111111  error"+Thread.currentThread());
//// 拉取会话列表失败
//                    }
//
//                    @Override
//                    public void onSuccess(V2TIMConversationResult v2TIMConversationResult) {
//                        List<V2TIMConversation> conversationList =  v2TIMConversationResult.getConversationList();
////                        conversations.clear();
////                        conversations.addAll(conversationList);
//                        conversations = conversationList;
//                        messageAdapter.notifyDataSetChanged();
//                        System.out.println(conversations.size()+"111111"+Thread.currentThread().getId());
//
//                    }
//                });
    }
}